var express = require('express');
var router = express.Router();
var url = require("url");
var md5 = require('md5');

var MongoClient = require("./../mongodb/MongoClient");
var MySql = require("./../mongodb/MySql");

router.get('/readPerson', function(req, res, next) {//读取数据库数据
	MongoClient.mongoConnect('pull', function(db){
		console.log('数据库连接成功')
		MySql.findData(db,"person",{},{},function(result){
			if(result.length == "0"){//没有用户
					res.send("0");
					db.close();
			}else{//用户已存在
				res.send(result);
				db.close();
			}
		})
	},function(err){
		res.send(err);
	})
});



module.exports = router;